package info.motteke.util.net;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;

public class HttpResponse {

    private final HttpURLConnection con;

    private final boolean errorResponse;

    public HttpResponse(HttpURLConnection con, boolean errorResponse) {
        this.con = con;
        this.errorResponse = errorResponse;
    }

    public int getStatusCode() throws IOException {
        return con.getResponseCode();
    }

    public InputStream getInputStream() throws IOException {
        if (errorResponse) {
            return con.getErrorStream();
        } else {
            return con.getInputStream();
        }
    }
}
